package ru.myrtle.umf.tools.ugen.templates;

import java.io.*;
import java.text.*;
import java.util.*;
import ru.myrtle.umf.*;
import ru.myrtle.umf.codegen.*;
import ru.myrtle.umf.codegen.java.*;
import ru.myrtle.umf.tools.ugen.*;

public class UModelTemplate extends UTemplate
{
    
    private String f_serializable(boolean yes) {
        return yes ? "UFlags.Serializable.YES" : "UFlags.Serializable.NO";
    }
    private String f_provided(boolean yes) {
        return yes ? "UFlags.Provided.YES" : "UFlags.Provided.NO";
    }
    private String f_virtual(boolean yes) {
        return yes ? "UFlags.Virtual.YES" : "UFlags.Virtual.NO";
    }
    private String f_transient(boolean yes) {
        return yes ? "UFlags.Transient.YES" : "UFlags.Transient.NO";
    }
    private String f_volatile(boolean yes) {
        return yes ? "UFlags.Volatile.YES" : "UFlags.Volatile.NO";
    }
    private String f_changeable(boolean yes) {
        return yes ? "UFlags.Changeable.YES" : "UFlags.Changeable.NO";
    }
    private String f_derived(boolean yes) {
        return yes ? "UFlags.Derived.YES" : "UFlags.Derived.NO";
    }
    private String f_identifying(boolean yes) {
        return yes ? "UFlags.Identifying.YES" : "UFlags.Identifying.NO";
    }
    private String f_many(boolean yes) {
        return yes ? "UFlags.Many.YES" : "UFlags.Many.NO";
    }
    private String f_ordered(boolean yes) {
        return yes ? "UFlags.Ordered.YES" : "UFlags.Ordered.NO";
    }
    private String f_unique(boolean yes) {
        return yes ? "UFlags.Unique.YES" : "UFlags.Unique.NO";
    }
    private String f_containment(boolean yes) {
        return yes ? "UFlags.Containment.YES" : "UFlags.Containment.NO";
    }
	
    protected final String NL = System.getProperties().getProperty("line.separator");
    protected final String TEXT_1 = "package ";
    protected final String TEXT_2 = ";" + NL + NL;
    protected final String TEXT_3 = NL + "public final class ";
    protected final String TEXT_4 = " extends UPackageImpl {" + NL + NL + "    private static final String NAME = \"";
    protected final String TEXT_5 = "\";" + NL + "    private static final String NAMESPACE_PREFIX = \"";
    protected final String TEXT_6 = "\";" + NL + "    private static final String NAMESPACE_URI = \"";
    protected final String TEXT_7 = "\";" + NL + NL;
    protected final String TEXT_8 = NL + "    public static final UDataType ";
    protected final String TEXT_9 = " = UModelFactory.INSTANCE.createUDataType();" + NL + "    " + NL;
    protected final String TEXT_10 = NL + "    public static final UEnumeration ";
    protected final String TEXT_11 = " = UModelFactory.INSTANCE.createUEnumeration();" + NL + NL;
    protected final String TEXT_12 = NL + "    public final UEnumerationLiteral ";
    protected final String TEXT_13 = " = UModelFactory.INSTANCE.createUEnumerationLiteral();" + NL + "    " + NL;
    protected final String TEXT_14 = NL + "    public static final UClass ";
    protected final String TEXT_15 = " = UModelFactory.INSTANCE.createUClass();" + NL + "    " + NL;
    protected final String TEXT_16 = NL + "    public static final UAttribute ";
    protected final String TEXT_17 = " = UModelFactory.INSTANCE.createUAttribute();" + NL + NL;
    protected final String TEXT_18 = NL + "    public static final UReference ";
    protected final String TEXT_19 = " = UModelFactory.INSTANCE.createUReference();" + NL + "    " + NL;
    protected final String TEXT_20 = NL + "    public static final UOperation ";
    protected final String TEXT_21 = " = UModelFactory.INSTANCE.createUOperation();" + NL + NL;
    protected final String TEXT_22 = NL + "    public static final UParameter ";
    protected final String TEXT_23 = " = UModelFactory.INSTANCE.createUParameter();" + NL + NL;
    protected final String TEXT_24 = NL + "    public static final ";
    protected final String TEXT_25 = " INSTANCE = new ";
    protected final String TEXT_26 = "();" + NL + NL + "    public ";
    protected final String TEXT_27 = "() {" + NL + "        setName(NAME);" + NL + "        setNamespacePrefix(NAMESPACE_PREFIX);" + NL + "        setNamespaceURI(NAMESPACE_URI);" + NL + "        setFactory(";
    protected final String TEXT_28 = ".INSTANCE);" + NL;
    protected final String TEXT_29 = "        getSubPackages().add(";
    protected final String TEXT_30 = ".INSTANCE);" + NL;
    protected final String TEXT_31 = NL;
    protected final String TEXT_32 = "        UUtilities.initDataType(";
    protected final String TEXT_33 = ", \"";
    protected final String TEXT_34 = "\", ";
    protected final String TEXT_35 = ", ";
    protected final String TEXT_36 = ", ";
    protected final String TEXT_37 = ");" + NL + "        getClassifiers().add(";
    protected final String TEXT_38 = ");" + NL + "        " + NL;
    protected final String TEXT_39 = "        UUtilities.initEnumeration(";
    protected final String TEXT_40 = ", \"";
    protected final String TEXT_41 = "\", ";
    protected final String TEXT_42 = ", ";
    protected final String TEXT_43 = ");" + NL + "        getClassifiers().add(";
    protected final String TEXT_44 = ");" + NL + "        " + NL;
    protected final String TEXT_45 = "        UUtilities.initEnumerationLiteral(";
    protected final String TEXT_46 = ", \"";
    protected final String TEXT_47 = "\");" + NL + "        ";
    protected final String TEXT_48 = ".getLiterals().add(";
    protected final String TEXT_49 = ");" + NL + "        " + NL;
    protected final String TEXT_50 = "        UUtilities.initClass(";
    protected final String TEXT_51 = ", \"";
    protected final String TEXT_52 = "\", ";
    protected final String TEXT_53 = ", ";
    protected final String TEXT_54 = ", ";
    protected final String TEXT_55 = ");" + NL;
    protected final String TEXT_56 = "        UUtilities.initClass(";
    protected final String TEXT_57 = ", \"";
    protected final String TEXT_58 = "\", ";
    protected final String TEXT_59 = ", ";
    protected final String TEXT_60 = ", ";
    protected final String TEXT_61 = ", ";
    protected final String TEXT_62 = ");" + NL;
    protected final String TEXT_63 = "        getClassifiers().add(";
    protected final String TEXT_64 = ");" + NL + NL;
    protected final String TEXT_65 = "        UUtilities.initAttribute(";
    protected final String TEXT_66 = ", \"";
    protected final String TEXT_67 = "\", ";
    protected final String TEXT_68 = ", ";
    protected final String TEXT_69 = ", ";
    protected final String TEXT_70 = ", ";
    protected final String TEXT_71 = ", ";
    protected final String TEXT_72 = ", ";
    protected final String TEXT_73 = ");" + NL + "        ";
    protected final String TEXT_74 = ".getFeatures().add(";
    protected final String TEXT_75 = ");" + NL + NL;
    protected final String TEXT_76 = "        UUtilities.initReference(";
    protected final String TEXT_77 = ", \"";
    protected final String TEXT_78 = "\", ";
    protected final String TEXT_79 = ", ";
    protected final String TEXT_80 = ", ";
    protected final String TEXT_81 = ", ";
    protected final String TEXT_82 = ", ";
    protected final String TEXT_83 = ", ";
    protected final String TEXT_84 = ", ";
    protected final String TEXT_85 = ", ";
    protected final String TEXT_86 = ", ";
    protected final String TEXT_87 = ", ";
    protected final String TEXT_88 = ");" + NL + "        ";
    protected final String TEXT_89 = ".getFeatures().add(";
    protected final String TEXT_90 = ");" + NL + NL;
    protected final String TEXT_91 = "        UUtilities.initOperation(";
    protected final String TEXT_92 = ", \"";
    protected final String TEXT_93 = "\", ";
    protected final String TEXT_94 = ", ";
    protected final String TEXT_95 = ", ";
    protected final String TEXT_96 = ", ";
    protected final String TEXT_97 = ", ";
    protected final String TEXT_98 = ");" + NL + "        ";
    protected final String TEXT_99 = ".getOperations().add(";
    protected final String TEXT_100 = ");" + NL + NL;
    protected final String TEXT_101 = "        UUtilities.initParameter(";
    protected final String TEXT_102 = ", \"";
    protected final String TEXT_103 = "\", ";
    protected final String TEXT_104 = ", ";
    protected final String TEXT_105 = ", ";
    protected final String TEXT_106 = ", ";
    protected final String TEXT_107 = ");" + NL + "        ";
    protected final String TEXT_108 = ".getParameters().add(";
    protected final String TEXT_109 = ");" + NL + NL;
    protected final String TEXT_110 = "    }" + NL + "}" + NL;

    /*
     *
     */


    public UModelTemplate() {

    }

    /*
     *
     */

    public String generate(UTemplateContext context) throws UTemplateRejectException
    {
        final StringBuffer stringBuffer = new StringBuffer();

    checkTemplateObjectType(context, UPackage.class);

    UPackage object = (UPackage) context.getObject();

    String modelClassName     = UGenUtil.getModelClassName(object);
    String modelClassPackage  = UGenUtil.getModelClassPackage(object);

    String factoryClassName     = UGenUtil.getFactoryClassName(object);
    String factoryClassPackage  = UGenUtil.getFactoryClassPackage(object);

    context.getResource().setObjectFileName(modelClassName);
    context.getResource().setObjectFileExtension("java");
    context.getResource().setObjectPackage(modelClassPackage);

    JavaImportBuilder importBuilder = new JavaImportBuilder();

    importBuilder.addPackage("ru.myrtle.umf");
    importBuilder.addPackage("ru.myrtle.umf.util");
    importBuilder.addPackage(factoryClassPackage);
    importBuilder.addPackage(
        UGenUtil.getObjectImplClassPackage(UModel.UPACKAGE)
    );

    createDoc();
    addDocDescription(
            object.getDescription()
    );
    addDocAnnotation("generated");

        stringBuffer.append(TEXT_1);
        stringBuffer.append(modelClassPackage);
        stringBuffer.append(TEXT_2);
        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_3);
        stringBuffer.append(modelClassName);
        stringBuffer.append(TEXT_4);
        stringBuffer.append(object.getName());
        stringBuffer.append(TEXT_5);
        stringBuffer.append(object.getNamespacePrefix());
        stringBuffer.append(TEXT_6);
        stringBuffer.append(object.getNamespaceURI());
        stringBuffer.append(TEXT_7);

    for (UDataType dataType : object.getDataTypes()) {
        String literal = UGenUtil.getClassifierLiteral(dataType);

        createDoc("    ");
        addDocDescription(
            "The meta object literal for the '<em>" + dataType.getName() + "</em>' data type."
        );
        addDocAnnotation("generated");

        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_8);
        stringBuffer.append(literal);
        stringBuffer.append(TEXT_9);

    }

    for (UEnumeration enumeration : object.getEnumerations()) {
        String literal = UGenUtil.getClassifierLiteral(enumeration);

        createDoc("    ");
        addDocDescription(
            "The meta object literal for the '<em>" + enumeration.getName() + "</em>' enumeration."
        );
        addDocAnnotation("generated");

        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_10);
        stringBuffer.append(literal);
        stringBuffer.append(TEXT_11);

        for (UEnumerationLiteral enumerationLiteral : enumeration.getLiterals()) {
            String enumLiteralLiteral = UGenUtil.getEnumerationLiteralLiteral(enumerationLiteral);

            createDoc("    ");
            addDocDescription(
                "The meta object literal for the '<em>" + enumerationLiteral.getName() + "</em>' enumeration literal."
            );
            addDocAnnotation("generated");

        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_12);
        stringBuffer.append(enumLiteralLiteral);
        stringBuffer.append(TEXT_13);

        }
    }

    for (UClass klass : object.getClasses()) {
        String klassLiteral = UGenUtil.getClassifierLiteral(klass);

        createDoc("    ");
        addDocDescription(
            "The meta object literal for the '{@link " + klass.getInstanceClassName() + " <em>" + klass.getName() + "</em>}' class."
        );
        addDocAnnotation("generated");

        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_14);
        stringBuffer.append(klassLiteral);
        stringBuffer.append(TEXT_15);

        for (UFeature feature : klass.getFeatures()) {
            String featureLiteral = UGenUtil.getFeatureLiteral(feature);

            if (feature instanceof UAttribute) {
                createDoc("    ");
                addDocDescription(
                    "The meta object literal for the '<em>" + feature.getName() + "</em>' attribute feature."
                );
                addDocAnnotation("generated");

        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_16);
        stringBuffer.append(featureLiteral);
        stringBuffer.append(TEXT_17);

            }
            else if (feature instanceof UReference) {
                createDoc("    ");
                addDocDescription(
                    "The meta object literal for the '<em>" + feature.getName() + "</em>' reference feature."
                );
                addDocAnnotation("generated");

        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_18);
        stringBuffer.append(featureLiteral);
        stringBuffer.append(TEXT_19);

            }
        }

        for (UOperation operation : klass.getOperations()) {
            String operationLiteral = UGenUtil.getOperationLiteral(operation);

            createDoc("    ");
            addDocDescription(
                "The meta object literal for the '<em>" + operation.getName() + "</em>' operation."
            );
            addDocAnnotation("generated");

        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_20);
        stringBuffer.append(operationLiteral);
        stringBuffer.append(TEXT_21);

            for (UParameter parameter : operation.getParameters()) {
                String parameterLiteral = UGenUtil.getOperationParameterLiteral(parameter);

                createDoc("    ");
                addDocDescription(
                    "The meta object literal for the '<em>" + parameter.getName() + "</em>' parameter."
                );
                addDocAnnotation("generated");

        stringBuffer.append(getDocString());
        stringBuffer.append(TEXT_22);
        stringBuffer.append(parameterLiteral);
        stringBuffer.append(TEXT_23);

            }
        }
    }

        stringBuffer.append(TEXT_24);
        stringBuffer.append(modelClassName);
        stringBuffer.append(TEXT_25);
        stringBuffer.append(modelClassName);
        stringBuffer.append(TEXT_26);
        stringBuffer.append(modelClassName);
        stringBuffer.append(TEXT_27);
        stringBuffer.append(factoryClassName);
        stringBuffer.append(TEXT_28);

        for (UPackage subPackage : object.getSubPackages()) {
            String subModelClassName     = UGenUtil.getModelClassName(subPackage);
            String subModelClassPackage  = UGenUtil.getModelClassPackage(subPackage);

            importBuilder.addPackage(subModelClassPackage);

        stringBuffer.append(TEXT_29);
        stringBuffer.append(subModelClassName);
        stringBuffer.append(TEXT_30);

        }

        stringBuffer.append(TEXT_31);

    for (UDataType dataType : object.getDataTypes()) {
        String name    = dataType.getName();
        String literal = UGenUtil.getClassifierLiteral(dataType);
        String type    = UGenUtil.createJavaTypeExpressionForType(dataType, importBuilder);
        String converter;

        if (dataType.isSerializable()) {
            String converterClassName    = UGenUtil.getConverterClassName(dataType);
            String converterClassPackage = UGenUtil.getConverterClassPackage(dataType);

            importBuilder.addPackage(
                converterClassPackage
            );

            converter = converterClassName + ".INSTANCE";
        }
        else {
            converter = "null";
        }

        stringBuffer.append(TEXT_32);
        stringBuffer.append(literal);
        stringBuffer.append(TEXT_33);
        stringBuffer.append(name);
        stringBuffer.append(TEXT_34);
        stringBuffer.append(type);
        stringBuffer.append(TEXT_35);
        stringBuffer.append(f_serializable(dataType.isSerializable()));
        stringBuffer.append(TEXT_36);
        stringBuffer.append(converter);
        stringBuffer.append(TEXT_37);
        stringBuffer.append(literal);
        stringBuffer.append(TEXT_38);

    }

    for (UEnumeration enumeration : object.getEnumerations()) {
        String name    = enumeration.getName();
        String literal = UGenUtil.getClassifierLiteral(enumeration);
        String type    = UGenUtil.createJavaTypeExpressionForType(enumeration, importBuilder);

        stringBuffer.append(TEXT_39);
        stringBuffer.append(literal);
        stringBuffer.append(TEXT_40);
        stringBuffer.append(name);
        stringBuffer.append(TEXT_41);
        stringBuffer.append(type);
        stringBuffer.append(TEXT_42);
        stringBuffer.append(f_serializable(enumeration.isSerializable()));
        stringBuffer.append(TEXT_43);
        stringBuffer.append(literal);
        stringBuffer.append(TEXT_44);

        for (UEnumerationLiteral enumerationLiteral : enumeration.getLiterals()) {
            String enumLiteralName    = enumerationLiteral.getName();
            String enumLiteralLiteral = UGenUtil.getEnumerationLiteralLiteral(enumerationLiteral);

        stringBuffer.append(TEXT_45);
        stringBuffer.append(enumLiteralLiteral);
        stringBuffer.append(TEXT_46);
        stringBuffer.append(enumLiteralName);
        stringBuffer.append(TEXT_47);
        stringBuffer.append(literal);
        stringBuffer.append(TEXT_48);
        stringBuffer.append(enumLiteralLiteral);
        stringBuffer.append(TEXT_49);

        }
    }

    for (UClass klass : object.getClasses()) {
        String klassName    = klass.getName();
        String klassLiteral = UGenUtil.getClassifierLiteral(klass);
        String type         = UGenUtil.createJavaTypeExpressionForType(klass, importBuilder);

        if (klass.getSuperTypes().isEmpty()) {

        stringBuffer.append(TEXT_50);
        stringBuffer.append(klassLiteral);
        stringBuffer.append(TEXT_51);
        stringBuffer.append(klassName);
        stringBuffer.append(TEXT_52);
        stringBuffer.append(type);
        stringBuffer.append(TEXT_53);
        stringBuffer.append(f_provided(klass.isProvided()));
        stringBuffer.append(TEXT_54);
        stringBuffer.append(f_virtual(klass.isVirtual()));
        stringBuffer.append(TEXT_55);

        }
        else {
            StringBuilder extendsList = new StringBuilder();

            for (UClass superType : klass.getSuperTypes()) {
                if (extendsList.length() > 0) {
                    extendsList.append(", ");
                }

                extendsList.append(
                    UGenUtil.getModelClassName(
                        superType.getPackage()
                    )
                );
                extendsList.append(".");
                extendsList.append(
                    UGenUtil.getClassifierLiteral(
                        superType
                    )
                );

                importBuilder.addPackage(
                    UGenUtil.getModelClassPackage(
                        superType.getPackage()
                    )
                );
            }

        stringBuffer.append(TEXT_56);
        stringBuffer.append(klassLiteral);
        stringBuffer.append(TEXT_57);
        stringBuffer.append(klassName);
        stringBuffer.append(TEXT_58);
        stringBuffer.append(type);
        stringBuffer.append(TEXT_59);
        stringBuffer.append(f_provided(klass.isProvided()));
        stringBuffer.append(TEXT_60);
        stringBuffer.append(f_virtual(klass.isVirtual()));
        stringBuffer.append(TEXT_61);
        stringBuffer.append(extendsList.toString());
        stringBuffer.append(TEXT_62);

        }

        stringBuffer.append(TEXT_63);
        stringBuffer.append(klassLiteral);
        stringBuffer.append(TEXT_64);

        for (UFeature feature : klass.getFeatures()) {
            String featureLiteral = UGenUtil.getFeatureLiteral(feature);
            String featureName    = feature.getName();

            if (feature instanceof UAttribute) {
                UAttribute attribute = (UAttribute) feature;

                String attributeType = UGenUtil.createExpressionForType(
                    attribute.getType()
                );

        stringBuffer.append(TEXT_65);
        stringBuffer.append(featureLiteral);
        stringBuffer.append(TEXT_66);
        stringBuffer.append(featureName);
        stringBuffer.append(TEXT_67);
        stringBuffer.append(f_transient(attribute.isTransient()));
        stringBuffer.append(TEXT_68);
        stringBuffer.append(f_volatile(attribute.isVolatile()));
        stringBuffer.append(TEXT_69);
        stringBuffer.append(f_changeable(attribute.isChangeable()));
        stringBuffer.append(TEXT_70);
        stringBuffer.append(f_derived(attribute.isDerived()));
        stringBuffer.append(TEXT_71);
        stringBuffer.append(attributeType);
        stringBuffer.append(TEXT_72);
        stringBuffer.append(f_identifying(attribute.isIdentifyingAttribute()));
        stringBuffer.append(TEXT_73);
        stringBuffer.append(klassLiteral);
        stringBuffer.append(TEXT_74);
        stringBuffer.append(featureLiteral);
        stringBuffer.append(TEXT_75);

            }
            else if (feature instanceof UReference) {
                UReference reference = (UReference) feature;

                String referenceType = UGenUtil.createExpressionForType(
                    reference.getType()
                );

                String oppositeString = "null";

                if (reference.getOpposite() != null) {
                    oppositeString = UGenUtil.createExpressionForFeature(
                        reference.getOpposite()
                    );
                }

        stringBuffer.append(TEXT_76);
        stringBuffer.append(featureLiteral);
        stringBuffer.append(TEXT_77);
        stringBuffer.append(featureName);
        stringBuffer.append(TEXT_78);
        stringBuffer.append(f_transient(reference.isTransient()));
        stringBuffer.append(TEXT_79);
        stringBuffer.append(f_volatile(reference.isVolatile()));
        stringBuffer.append(TEXT_80);
        stringBuffer.append(f_changeable(reference.isChangeable()));
        stringBuffer.append(TEXT_81);
        stringBuffer.append(f_derived(reference.isDerived()));
        stringBuffer.append(TEXT_82);
        stringBuffer.append(referenceType);
        stringBuffer.append(TEXT_83);
        stringBuffer.append(f_many(reference.isMany()));
        stringBuffer.append(TEXT_84);
        stringBuffer.append(f_ordered(reference.isOrdered()));
        stringBuffer.append(TEXT_85);
        stringBuffer.append(f_unique(reference.isUnique()));
        stringBuffer.append(TEXT_86);
        stringBuffer.append(f_containment(reference.isContainment()));
        stringBuffer.append(TEXT_87);
        stringBuffer.append(oppositeString);
        stringBuffer.append(TEXT_88);
        stringBuffer.append(klassLiteral);
        stringBuffer.append(TEXT_89);
        stringBuffer.append(featureLiteral);
        stringBuffer.append(TEXT_90);

            }
        }

        for (UOperation operation : klass.getOperations()) {
            String operationLiteral = UGenUtil.getOperationLiteral(operation);
            String operationName    = operation.getName();

            String operationType = UGenUtil.createExpressionForType(
                operation.getType()
            );

        stringBuffer.append(TEXT_91);
        stringBuffer.append(operationLiteral);
        stringBuffer.append(TEXT_92);
        stringBuffer.append(operationName);
        stringBuffer.append(TEXT_93);
        stringBuffer.append(operationType);
        stringBuffer.append(TEXT_94);
        stringBuffer.append(f_provided(klass.isProvided()));
        stringBuffer.append(TEXT_95);
        stringBuffer.append(f_many(operation.isMany()));
        stringBuffer.append(TEXT_96);
        stringBuffer.append(f_ordered(operation.isOrdered()));
        stringBuffer.append(TEXT_97);
        stringBuffer.append(f_unique(operation.isUnique()));
        stringBuffer.append(TEXT_98);
        stringBuffer.append(klassLiteral);
        stringBuffer.append(TEXT_99);
        stringBuffer.append(operationLiteral);
        stringBuffer.append(TEXT_100);

            for (UParameter parameter : operation.getParameters()) {
                String parameterLiteral = UGenUtil.getOperationParameterLiteral(parameter);
                String parameterName    = parameter.getName();

                String parameterType = UGenUtil.createExpressionForType(
                    parameter.getType()
                );

        stringBuffer.append(TEXT_101);
        stringBuffer.append(parameterLiteral);
        stringBuffer.append(TEXT_102);
        stringBuffer.append(parameterName);
        stringBuffer.append(TEXT_103);
        stringBuffer.append(parameterType);
        stringBuffer.append(TEXT_104);
        stringBuffer.append(f_many(operation.isMany()));
        stringBuffer.append(TEXT_105);
        stringBuffer.append(f_ordered(operation.isOrdered()));
        stringBuffer.append(TEXT_106);
        stringBuffer.append(f_unique(operation.isUnique()));
        stringBuffer.append(TEXT_107);
        stringBuffer.append(operationLiteral);
        stringBuffer.append(TEXT_108);
        stringBuffer.append(parameterLiteral);
        stringBuffer.append(TEXT_109);

            }
        }
    }

        stringBuffer.append(TEXT_110);

    insertImport(stringBuffer, importBuilder, modelClassPackage);


        return stringBuffer.toString();
    }

    // ---------------------------------------------------------------------------------------
    // ---------------------------------------------------------------------------------------

}
